﻿using UnityEngine;
using System.Collections;

public class Mute : MonoBehaviour {

	public AudioSource audio;
	tk2dSlicedSprite change;
	bool check;

	void onClickButton()
	{
				//Debug.Log ("Play" + GLOBAL.isMute);
				if (GLOBAL.isMute == true) {
						audio.Play ();
						GLOBAL.isMute = false;

				} else {

						if (audio.isPlaying == true) {
								audio.Stop ();
								GLOBAL.isMute = true;				
						}

				}
	}
	void OnMouseDown()
	{	
		if (check) 
		{
			Debug.Log("aaa");
			change.SetSprite("on");
		}
		else
		{
			change.SetSprite("off");

		}
		check = !check;
	}
	// Use this for initialization
	void Start () {
		audio.Play ();
		change = this.GetComponentInChildren<tk2dSlicedSprite> ();
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
